﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using EnglishStudy.ViewModel;

namespace EnglishStudy.View
{
    public partial class VocabularyPage : PhoneApplicationPage
    {
        string DBConnectionString = "Data Source=isostore:/LessonData.sdf";
        VocabularyViewModel viewModel;
        public VocabularyPage()
        {
            InitializeComponent();
            viewModel = new VocabularyViewModel(DBConnectionString);
            App.ViewModel.LoadUserData();
            this.DataContext = viewModel;
        }

        private void ListWord_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show(ListWord.SelectedIndex.ToString());
        }

        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            // Save changes to the database.
            viewModel.SaveChangesToDB();

            base.OnNavigatedFrom(e);
        }
    }
}